home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-SPAR.{_6 / ASMMACRO.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  71 lines

  1. /* asmmacro.h: Assembler macros.
  2.  *
  3.  * Copyright (C) 1996 David S. Miller (davem@caipfs.rutgers.edu)
  4.  */
  5.  
  6. #ifndef _SPARC_ASMMACRO_H
  7. #define _SPARC_ASMMACRO_H
  8.  
  9. #include <linux/config.h>
  10. #include <asm/btfixup.h>
  11. #include <asm/asi.h>
  12.  
  13. #define GET_PROCESSOR4M_ID(reg) \
  14.     rd    %tbr, %reg; \
  15.     srl    %reg, 12, %reg; \
  16.     and    %reg, 3, %reg;
  17.  
  18. #define GET_PROCESSOR4D_ID(reg) \
  19.     lda    [%g0] ASI_M_VIKING_TMP1, %reg;
  20.  
  21. /* Blackbox */
  22. #define GET_PROCESSOR_ID(reg) \
  23.     sethi    %hi(___b_smp_processor_id), %reg; \
  24.     sethi    %hi(boot_cpu_id), %reg; \
  25.     ldub    [%reg + %lo(boot_cpu_id)], %reg;
  26.  
  27. #define GET_PROCESSOR_MID(reg, tmp) \
  28.     rd    %tbr, %reg; \
  29.     sethi    C_LABEL(mid_xlate), %tmp; \
  30.     srl    %reg, 12, %reg; \
  31.     or    %tmp, %lo(C_LABEL(mid_xlate)), %tmp; \
  32.     and    %reg, 3, %reg; \
  33.     ldub    [%tmp + %reg], %reg;
  34.  
  35. #define GET_PROCESSOR_OFFSET(reg, tmp) \
  36.     GET_PROCESSOR_ID(reg) \
  37.     sethi    C_LABEL(cpu_offset), %tmp; \
  38.     sll    %reg, 2, %reg; \
  39.     or    %tmp, %lo(C_LABEL(cpu_offset)), %tmp; \
  40.     ld    [%tmp + %reg], %reg;
  41.  
  42. #define GET_PAGE_OFFSET(reg) \
  43.     sethi    BTFIXUP_SETHI_INIT(page_offset,0xf0000000), %reg;
  44.  
  45. /* All trap entry points _must_ begin with this macro or else you
  46.  * lose.  It makes sure the kernel has a proper window so that
  47.  * c-code can be called.
  48.  */
  49. #define SAVE_ALL_HEAD \
  50.     sethi    %hi(trap_setup), %l4; \
  51.     jmpl    %l4 + %lo(trap_setup), %l6;
  52. #define SAVE_ALL \
  53.     SAVE_ALL_HEAD \
  54.      nop;
  55.  
  56. /* All traps low-level code here must end with this macro. */
  57. #define RESTORE_ALL b ret_trap_entry; clr %l6;
  58.  
  59. /* sun4 probably wants half word accesses to ASI_SEGMAP, while sun4c+
  60.    likes byte accesses. These are to avoid ifdef mania. */
  61.  
  62. #ifdef CONFIG_SUN4
  63. #define lduXa    lduha
  64. #define stXa    stha
  65. #else
  66. #define lduXa    lduba
  67. #define stXa    stba
  68. #endif
  69.  
  70. #endif /* !(_SPARC_ASMMACRO_H) */
  71.